// NewsReader.h : Declaration of the CNewsReader

#ifndef __NEWSREADER_H_
#define __NEWSREADER_H_

#include "resource.h"       // main symbols
#include <comdef.h>
#include <shlobj.h>
#include "TickerWindow.h"

typedef struct tagProvider {
	HMODULE					hModule;
	CreateFunc*				fpCreate;
	ReleaseFunc*			fpRelease;
	INewsContentProvider*	pvdr;
} Provider;


/////////////////////////////////////////////////////////////////////////////
// CNewsReader
class ATL_NO_VTABLE CNewsReader : 
	public CComObjectRootEx<CComSingleThreadModel>,
	public CComCoClass<CNewsReader, &CLSID_NewsReader>,
	public IDispatchImpl<INewsReader, &IID_INewsReader, &LIBID_NEWSREADERBANDLib>,
	public IObjectWithSite,
	public IPersistStream,
	public IDeskBand,
	public CTickerWindow
{
public:
	CNewsReader();
	virtual ~CNewsReader();

DECLARE_REGISTRY_RESOURCEID(IDR_NEWSREADER)

DECLARE_PROTECT_FINAL_CONSTRUCT()

BEGIN_COM_MAP(CNewsReader)
	COM_INTERFACE_ENTRY(INewsReader)
	COM_INTERFACE_ENTRY(IDispatch)
	COM_INTERFACE_ENTRY(IObjectWithSite)
	COM_INTERFACE_ENTRY(IPersistStream)	
	COM_INTERFACE_ENTRY(IDeskBand)
END_COM_MAP()

BEGIN_CATEGORY_MAP(CNewsReader)				
	IMPLEMENTED_CATEGORY(CATID_DeskBand)	
	IMPLEMENTED_CATEGORY(CATID_CommBand)	
END_CATEGORY_MAP()							

BEGIN_MSG_MAP(CNewsReader)
//	MESSAGE_HANDLER(WM_TIMER, OnTimer)
	CHAIN_MSG_MAP(CTickerWindow)
//    COMMAND_ID_HANDLER(IDM_XXX, OnXXX)
END_MSG_MAP()



// INewsReader
public:
   //IOleWindow methods
   STDMETHOD (GetWindow) (HWND*);
   STDMETHOD (ContextSensitiveHelp) (BOOL);

   //IDockingWindow methods
   STDMETHOD (ShowDW) (BOOL fShow);
   STDMETHOD (CloseDW) (DWORD dwReserved);
   STDMETHOD (ResizeBorderDW) (LPCRECT prcBorder, IUnknown* punkToolbarSite, BOOL fReserved);

   //IDeskBand methods
   STDMETHOD (GetBandInfo) (DWORD, DWORD, DESKBANDINFO*);

   //IObjectWithSite methods
   STDMETHOD (SetSite) (IUnknown*);
   STDMETHOD (GetSite) (REFIID, LPVOID*);

   //IPersistStream methods
   STDMETHOD (GetClassID) (LPCLSID);
   STDMETHOD (IsDirty) (void);
   STDMETHOD (Load) (LPSTREAM);
   STDMETHOD (Save) (LPSTREAM, BOOL);
   STDMETHOD (GetSizeMax) (ULARGE_INTEGER*);

protected:
	IOleWindow*				m_pSite;
	HWND					m_hParentWnd;

	HRESULT			CreateBandWindow();

};

#endif //__NEWSREADER_H_
